<template>
	<view class="container">
		<view class="logo" v-if="web_log">
			<image :src="web_log" />
		</view>
		<rich-text class="content" :nodes="content"></rich-text>
		<view class="copyright" v-if="web_copyright">{{web_copyright}}</view>
	</view>
</template>

<script>
	import { getAboutUsContent } from '@/api/site.js'
	export default {
		data() {
			return {
				web_log: '',
				content: '',
				web_copyright: '',
				errCont: '<p style="text-align: center; font-size: 16px">加载失败</p>'
			}
		},
		onLoad() {
			this.init()
		},
		methods: {
			init: function() {
				getAboutUsContent().then(res=> {
					if (res.code === 200) {
						const { web_log, about_me, web_copyright } = res.data
						this.web_log = web_log
						this.content = about_me
						this.web_copyright = web_copyright
					} else {
						this.content = this.errCont
					}
				}).catch(err => {
					this.content = this.errCont
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		height: 100vh;
		background-color: #FFFFFF;
		padding: 24rpx 32rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		flex-direction: column;
		.logo {
			width: 200rpx;
			height: 200rpx;
		}
		.content {
			flex: 1;
			padding: 40rpx 0;
		}
		.copyright {
			font-size: 28rpx;
		}
	}
</style>
